<!-- 信访分析标签页 -->
<div class="space-y-6">
    <!-- 页面头部 -->
    <div class="flex justify-between items-center">
        <div>
            <h2 class="text-xl font-semibold text-slate-800">AI分析任务</h2>
            <p class="text-slate-600 mt-1">管理和监控AI分析任务的执行状态</p>
        </div>
        <div class="flex space-x-3">
            <button onclick="analysisManager.showAddTaskModal()" 
                    class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors">
                <i class="fas fa-plus mr-2"></i>新建分析
            </button>
            <button onclick="analysisManager.manualRefresh()" 
                    class="px-4 py-2 border border-slate-300 text-slate-700 rounded-lg hover:bg-slate-50 transition-colors">
                <i class="fas fa-sync-alt mr-2"></i>手动刷新
            </button>
            <button onclick="analysisManager.toggleAutoRefresh()" 
                    id="autoRefreshToggle"
                    class="px-4 py-2 border border-slate-300 text-slate-700 rounded-lg hover:bg-slate-50 transition-colors">
                <i class="fas fa-pause mr-2"></i>暂停自动刷新
            </button>
        </div>
        <div class="text-sm text-slate-500">
            <span id="refreshStatus">自动刷新已启用</span> | 
            <span id="requestInfo">请求计数: 0</span> |
            <span id="errorInfo">错误计数: 0</span>
        </div>
    </div>

    <!-- 分析任务统计 -->
    <div class="grid grid-cols-1 md:grid-cols-5 gap-4">
        <div class="stat-card total">
            <div class="stat-card-content">
                <div class="stat-card-info">
                    <h3>总任务</h3>
                    <p class="stat-card-value" id="totalTasksCount">0</p>
                </div>
                <div class="stat-card-icon">
                    <i class="fas fa-tasks"></i>
                </div>
            </div>
        </div>
        <div class="stat-card warning">
            <div class="stat-card-content">
                <div class="stat-card-info">
                    <h3>待执行</h3>
                    <p class="stat-card-value" id="pendingTasksCount">0</p>
                </div>
                <div class="stat-card-icon">
                    <i class="fas fa-hourglass-half"></i>
                </div>
            </div>
        </div>
        <div class="stat-card active">
            <div class="stat-card-content">
                <div class="stat-card-info">
                    <h3>已完成</h3>
                    <p class="stat-card-value" id="completedTasksCount">0</p>
                </div>
                <div class="stat-card-icon">
                    <i class="fas fa-check-circle"></i>
                </div>
            </div>
        </div>
        <div class="stat-card error">
            <div class="stat-card-content">
                <div class="stat-card-info">
                    <h3>进行中</h3>
                    <p class="stat-card-value" id="runningTasksCount">0</p>
                </div>
                <div class="stat-card-icon">
                    <i class="fas fa-clock"></i>
                </div>
            </div>
        </div>
        <div class="stat-card excel">
            <div class="stat-card-content">
                <div class="stat-card-info">
                    <h3>失败</h3>
                    <p class="stat-card-value" id="failedTasksCount">0</p>
                </div>
                <div class="stat-card-icon">
                    <i class="fas fa-exclamation-triangle"></i>
                </div>
            </div>
        </div>
    </div>

    <!-- 筛选器 -->
    <div class="bg-white p-4 rounded-lg border border-slate-200">
        <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
            <div>
                <label class="block text-sm font-medium text-slate-700 mb-2">任务状态</label>
                <select id="taskStatusFilter" onchange="analysisManager.applyFilters()" 
                        class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
                    <option value="">全部状态</option>
                    <option value="pending">待执行</option>
                    <option value="running">进行中</option>
                    <option value="completed">已完成</option>
                    <option value="failed">失败</option>
                    <option value="cancelled">已取消</option>
                </select>
            </div>
            <div>
                <label class="block text-sm font-medium text-slate-700 mb-2">任务类型</label>
                <select id="taskTypeFilter" onchange="analysisManager.applyFilters()" 
                        class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
                    <option value="">全部类型</option>
                    <option value="RegionalAnalysis">区域分析</option>
                    <option value="ComplaintTypeAnalysis">信访类型分析</option>
                    <option value="SentimentAnalysis">情感分析</option>
                    <option value="ComplianceAnalysis">规范性分析</option>
                    <option value="DuplicateAnalysis">重复信访分析</option>
                </select>
            </div>
            <div>
                <label class="block text-sm font-medium text-slate-700 mb-2">执行类型</label>
                <select id="executionTypeFilter" onchange="analysisManager.applyFilters()" 
                        class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
                    <option value="">全部执行方式</option>
                    <option value="single_analysis">单次分析</option>
                    <option value="batch_analysis">批量分析</option>
                </select>
            </div>
            <div>
                <label class="block text-sm font-medium text-slate-700 mb-2">搜索</label>
                <input type="text" id="taskSearchInput" placeholder="搜索任务名称..." 
                       onkeyup="analysisManager.applyFilters()"
                       class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
            </div>
        </div>
    </div>

    <!-- 任务列表表格 -->
    <div class="bg-white rounded-lg border border-slate-200 overflow-hidden">
        <div class="overflow-x-auto">
            <table class="min-w-full divide-y divide-slate-200">
                <thead class="bg-slate-50">
                    <tr>
                        <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">
                            任务信息
                        </th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">
                            任务类型
                        </th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">
                            状态
                        </th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">
                            进度
                        </th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">
                            执行统计
                        </th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">
                            创建时间
                        </th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">
                            操作
                        </th>
                    </tr>
                </thead>
                <tbody id="taskTableBody" class="bg-white divide-y divide-slate-200">
                    <!-- 任务行将通过JavaScript动态生成 -->
                </tbody>
            </table>
        </div>
        
        <!-- 空状态 -->
        <div id="tasksEmptyState" class="hidden text-center py-12">
            <i class="fas fa-inbox text-4xl text-slate-300 mb-4"></i>
            <p class="text-slate-500">暂无任务数据</p>
            <button onclick="analysisManager.showAddTaskModal()" 
                    class="mt-4 px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors">
                <i class="fas fa-plus mr-2"></i>创建第一个任务
            </button>
        </div>
        
        <!-- 加载状态 -->
        <div id="tasksLoadingState" class="hidden text-center py-12">
            <div class="inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"></div>
            <p class="mt-2 text-slate-600">正在加载任务数据...</p>
        </div>
    </div>

    <!-- 分页 -->
    <div id="tasksPagination" class="hidden flex items-center justify-between">
        <div class="text-sm text-slate-700">
            显示第 <span id="pageStart">0</span> 到 <span id="pageEnd">0</span> 条，共 <span id="totalItems">0</span> 条记录
        </div>
        <div class="pagination" id="paginationContainer">
            <!-- 分页按钮将通过JavaScript动态生成 -->
        </div>
    </div>
</div>